package com.huidao.servlet.Goods;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.huidao.service.GoodsService;
import com.huidao.service.GoodsServiceImp;


public class delGoodsServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

    public delGoodsServlet() {
        super();
        // TODO Auto-generated constructor stub
    }


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String gid = request.getParameter("gid");
		GoodsService gs = new GoodsServiceImp();
		String data = gs.delGoods(Long.parseLong(gid));
		if(data.equals("")){
			System.out.println(request.getParameter("currentpage"));
			response.sendRedirect("ShoppingCartListServlet?currentpage="+request.getParameter("currentpage"));
		}else{
			response.getWriter().print(data);
		}
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}

}
